import jdk.internal.org.objectweb.asm.tree.IincInsnNode;

import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
class Imp implements Comparator<Integer> {
    @Override
    public int compare(Integer o1, Integer o2) {
        return o2.compareTo(o1);
    }
}
public class Test {
    public static void main2(String[] args) {
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>();
        int[] array = {1,3,15,7,19,10};
        for (int i = 0;i < array.length;i++) {
            priorityQueue.offer(array[i]);
        }
        int k = 3;
        int[] ret = new int[k];
        for (int i = 0;i < k;i++) {
            ret[i] = priorityQueue.poll();
        }
        System.out.println(Arrays.toString(ret));
        System.out.println("====");
    }
    public static void main11(String[] args) {
        Imp imp = new Imp();
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>(imp);
        priorityQueue.offer(10);
        priorityQueue.offer(45);
        priorityQueue.offer(23);
        System.out.println(priorityQueue.peek());
        System.out.println(priorityQueue.poll());
        System.out.println(priorityQueue.peek());
    }
    public static void main(String[] args) {
        TestHeap testHeap = new TestHeap();
        int[] array = {27,15,19,18,28,34,65,49,25,37};
        testHeap.initElem(array);
        testHeap.createHead();
        testHeap.heapSort();
        System.out.println("=====");
    }
}
